package com.hongyuan.sellfitness.ui.find.activity;

import android.os.Bundle;

import androidx.lifecycle.ViewModelProviders;

import com.hongyuan.sellfitness.R;
import com.hongyuan.sellfitness.base.AppViewModelFactory;
import com.hongyuan.sellfitness.base.Constants;
import com.hongyuan.sellfitness.base.CustomActivity;
import com.hongyuan.sellfitness.databinding.ActivityChoseCricleBinding;
import com.hongyuan.sellfitness.ui.find.view_mode.ChoseCircleViewModel;

import me.tatarka.bindingcollectionadapter2.BR;

public class ChoseCircleActivity extends CustomActivity<ActivityChoseCricleBinding, ChoseCircleViewModel> {

    @Override
    public int initContentView(Bundle savedInstanceState) {
        return R.layout.activity_chose_cricle;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public ChoseCircleViewModel initViewModel() {
        AppViewModelFactory factory = AppViewModelFactory.getInstance(getApplication());
        return ViewModelProviders.of(this, factory).get(ChoseCircleViewModel.class);
    }

    @Override
    public void initView() {
        super.initView();
        setOnRefresh(binding.refresh,REFRESH_0X3);

        setEnableLoadMore(Constants.GET_CIRCLE_CATEGORY_LIST);
        setEnableRefresh(Constants.GET_CIRCLE_CATEGORY_LIST);

        binding.comBack.setOnClickListener(view -> finish());
    }

    @Override
    public void initData() {
        super.initData();

        //请求左边数据，只请求一次
        viewModel.setParams("parent_id","0");
        viewModel.requestData(Constants.GET_CIRCLE_CATEGORY_LIST);
    }

    @Override
    public void initViewObservable() {
        super.initViewObservable();

        viewModel.uc.showCancel.observe(this, aVoid -> {

        });
    }
}
